package com.stage.models;

import javax.persistence.*;

/**
 * Created by Stage on 2017/4/16.
 */
@Entity
@Table(name = "Person", schema = "dbo", catalog = "JavaHomeWork")
public class PersonEntity {
    private int id;
    private String merried;
    private String gender;
    private int age;
    private String idNo;
    private String name;

    @Id
    @Column(name = "Id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "Merried", nullable = false, length = 8)
    public String getMerried() {
        return merried;
    }

    public void setMerried(String merried) {
        this.merried = merried;
    }

    @Basic
    @Column(name = "Gender", nullable = false, length = 4)
    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    @Basic
    @Column(name = "Age", nullable = false)
    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Basic
    @Column(name = "IdNo", nullable = false, length = 20)
    public String getIdNo() {
        return idNo;
    }

    public void setIdNo(String idNo) {
        this.idNo = idNo;
    }

    @Basic
    @Column(name = "Name", nullable = false, length = 16)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;

        PersonEntity that = (PersonEntity) object;

        if (id != that.id) return false;
        if (age != that.age) return false;
        if (merried != null ? !merried.equals(that.merried) : that.merried != null) return false;
        if (gender != null ? !gender.equals(that.gender) : that.gender != null) return false;
        if (idNo != null ? !idNo.equals(that.idNo) : that.idNo != null) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (merried != null ? merried.hashCode() : 0);
        result = 31 * result + (gender != null ? gender.hashCode() : 0);
        result = 31 * result + age;
        result = 31 * result + (idNo != null ? idNo.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        return result;
    }
}
